<!DOCTYPE html>
<html>

<head>
  <title>登录</title>
  <% include layout/lib.ejs %>
  <link rel="stylesheet" type="text/css" href="/css/managerLogin.css" />
</head>

<body>
  <div class="managerLoginBg" style="background-image: url(/image/dkp_15.jpeg);background-size:cover;">
    <div class="managerLoginBox">
      <div class="managerLoginInput"
        style="text-align:center;margin-bottom:-30px;color:#eee;letter-spacing:1px;font-size:18px;"><b>UFO</b> 公会管理后台
      </div>
      <div class="managerLoginInput">
        <i class="fa fa-user-circle-o fa-lg"></i>
        <input type="text" name="username" placeholder="请输入管理员帐号" />
      </div>
      <div class="managerLoginInput">
        <i class="fa fa-key fa-lg"></i>
        <input type="password" name="password" placeholder="请输入管理员密码" />
      </div>
      <div class="managerLoginRadio">
        <input type="radio" name="teamValue" value="1" checked />&nbsp;黑翼团&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="radio" name="teamValue" value="3" />&nbsp;安琪拉团
      </div>
      <div class="managerLoginButton">
        登录
      </div>
    </div>
  </div>
</body>

</html>
<script>

    $(".managerLoginButton").click(function () {

      var username  = $("input[name=username]").val();
      var password  = $("input[name=password]").val();
      var teamValue = $('input[name="teamValue"]:checked').val();

      if (str_trim(username).length <= 0) {
        POP.warning("验证提示", "用户帐号不能为空");
        return;
      }

      if (str_trim(password).length <= 0) {
        POP.warning("验证提示", "用户密码不能为空");
        return;
      }

      var params = {
        username  : username,
        password  : password,
        teamValue : teamValue
      }

      POP.startLoading();

      HTTP.post("/dkpAction/managerLogin", params, (rs) => {

        POP.endLoading();
        POP.success("提示信息", "恭喜您，登录成功");

        //存储到本地
        customStorage.setPersistenceValue("a_id", rs.a_id);
        customStorage.setPersistenceValue("a_username", rs.a_username);
        customStorage.setPersistenceValue("teamValue", teamValue);

        setTimeout(() => {
          location.href = "/managerIndex";
        }, 1000)
      })

    });
</script>